var app = getApp();
Page({

  data: {
    info:[],
    kkk:0,
    date: '',
    liyou:'',
    date2:'',
    choose:'',
    itemList: ['正常', '返工','报废'],
    status:'点击选择状态',
    userInfo: null,
    title:'',
    buttom:'',
    zhicheng:'',
    
  },

  onLoad: function (options) {},
  onShow:function(){
    this.getlist()
  },

  getlist:function (){
    // var lid = 1
    var that = this

    wx.request({
      url: app.apiUrl + '/api/index/getworklist',
      data: {
        openid:wx.getStorageSync('openid'),
      },
      method: 'post',
      header: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
      success: function (res) {

        if(res.data.data.length > 0){
          that.setData({ info: res.data.data});
        }else{
          that.setData({ kkk: 1});
        }

      }
    });
  },


  tongguo:function (e){
    var that = this
    wx.request({
      url: app.apiUrl + '/api/index/worktongguo',
      data: {
        id:e.currentTarget.dataset.fee,
        stutus:1,
        openid:wx.getStorageSync('openid'),
        groupid: wx.getStorageSync('groupid'),
      },
      method: 'post',
      header: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
      success: function (res) {
        wx.showModal({
          title: '温馨提示',
          content: res.data.msg,
          showCancel: false
        });
       // that.getlist()
       setTimeout(function () {
        wx.redirectTo({
          url: '/page/my/index',
        })
      }, 2000)

      }
    });
  },



  jujue:function (e){
    var that = this
    wx.request({
      url: app.apiUrl + '/api/index/workjujue',
      data: {
        id:e.currentTarget.dataset.fee,
        stutus:2,
        openid:wx.getStorageSync('openid'),
        groupid: wx.getStorageSync('groupid'),
      },
      method: 'post',
      header: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
      success: function (res) {
        wx.showModal({
          title: '温馨提示',
          content: res.data.msg,
          showCancel: false
        });
        setTimeout(function () {
          wx.redirectTo({
            url: '/page/my/index',
          }) 
        }, 2000)
        //that.getlist()
   
      }
    });
  },


})